<?php
//print_r($_GET);//Array ( [pid] => 161 [snums] => 100 )
include_once("../function.php");

//1判断用户是否登录
if(!isset($_COOKIE['username']))
{
	msg("尚未登录，请登录","./login.php");exit;
}
extract($_GET);//$pid $num 
$pid=trim($pid);
//$num=trim($num);
$snums=trim($snums);
if($num>0)
{
	$num=$num-1;
	$sql="update ts_cart set num='$num' where cart_id='$cart_id'";
	$res=mysqli_query($link,$sql);
	if($res)
	{
		if(mysqli_affected_rows($link)==1)
		{
			header("location:./shopcar.php");exit;
		}		
	}	
}
else
{
	header("location:./shopcar.php");exit;
}
?>